let backTop01 = document.getElementById("backTop01");
let fixedPictureDiv = document.getElementById("fixedPicture");
scrollToTop(backTop01, 0, fixedPictureDiv, fixedPictureDiv.children[0], "animateDiv", "animateImg", timeSpan = 50);

// 接下来进行封装回到顶部的函数
function scrollToTop(ele1, targetPoint, fixedAnimateDiv, fixedAnimateImg, styleClass01, styleClass02) // 要传入的参数有 ：点击谁--ele1？到哪去--targetPoint？
{
	try {
		// 先检验这个要点击的对象是否存在，用if语句
		if(ele1) {

			// 当这个点击的对象存在时
			ele1.addEventListener("click", function() {

				clearInterval(ele1.set);
				ele1.set = null;
				let sc = null,
					sc01 = null;
				ele1.set = setInterval(function() {
					sc = document.documentElement.scrollTop || document.body.scrollTop;
					sc01 = sc / 7;
					if(sc <= targetPoint) {
						fixedAnimateDiv.classList.remove("animateDiv");
						fixedAnimateImg.classList.remove("animateImg");
						clearInterval(ele1.set);
						ele1.set = null;

					} else {
						fixedAnimateDiv.classList.add("animateDiv");
						fixedAnimateImg.classList.add("animateImg");
					}

					window.scrollTo(0, (sc - sc01));
				}, timeSpan);
				let stopAnimate = null;
				document.addEventListener("mousewheel", stopAnimate = function() {
					clearInterval(ele1.set);
					ele1.set = null;
					fixedAnimateDiv.classList.remove("animateDiv");
					fixedAnimateImg.classList.remove("animateImg");
				});
				//当手指滑动页面时，也阻止定时器运行，停止页面滚动
				window.addEventListener("touchmove", stopAnimate);

			});

		} else {
			throw "这个对象不存在，请注意是否正确获取目标点击对象";
		}
	} catch(err) {
		alert(err);
	}

	function windowScrollTo(ss1, ss2) {
		window.scrollTo(ss1 - ss2);

	}

}